export function time(x,data = new Date()) {
  let ye = data.getFullYear();
  let mo = data.getMonth() + 1;
  let da = data.getDate();
  let h = data.getHours();
  h = h < 10 ? "0" + h : h;
  let m = data.getMinutes();
  m = m < 10 ? "0" + m : m;
  let s = data.getSeconds();
  s = s < 10 ? "0" + s : s;
  if (x === "all") {
    return ye + "-" + mo + "-" + da + " " + h + ":" + m + ":" + s;
  }
  if (x === "date") {
    return ye + "-" + mo + "-" + da;
  } else if (x === "time") {
    return h + ":" + m + ":" + s;
  } else {
    return ye + "-" + mo + "-" + da + " " + h + ":" + m + ":" + s;
  }
}